// 暂不对外公开协议
// Created by ruiyan on 2022/3/30.
//

#ifndef RKBOX_SHI_LIAN_INTERDATADEFINE_H
#define RKBOX_SHI_LIAN_INTERDATADEFINE_H

#include "DataDefine.h"

enum GndToSkyPtzPIDEnum {
	ptzPID_pitch = 0xD1, //修改俯仰PID
	ptzPID_Yaw = 0xD2,  //修改航向PID
};

enum GndToSkyAlgParamsEnum {
	params_detect = 0xE1, //修改检测算法参数
	params_track = 0xE2,  //修改追踪算法参数
};

#pragma pack(1)

/**
 *  地面到吊舱 查询追踪PID信息
 */
typedef struct gnd_skynode_querypid_stru {
	common_header_stru header;     //包头
	unsigned short crc;            //CRC校验
} GND_SKYNODE_QUERYPID_S;

/**
 *  地面到吊舱 查询算法设置信息
 */
typedef struct gnd_skynode_query_alg_params_stru {
	common_header_stru header;     //包头
	unsigned char deviceNo;         //要查询的设备编号
	unsigned short crc;            //CRC校验
} GND_SKYNODE_QUERY_ALG_PARAMS_STRU;

/**
 * 检测算法参数
 */
struct DetectParams {
	unsigned short detectObjThres; //精度0.01，需要*0.01在给算法
	unsigned int detectMinBBoxSize;
};

/**
 * 追踪算法参数
 */
struct TrackParams {
	unsigned int searchSize;
	unsigned int tmplSize;
	unsigned int srcWidth;   // 可见光是1920 红外是608
	unsigned int srcHeight;  // 可见光是1080 红外是352
	unsigned short thresholdLow; //精度0.01，需要*0.01在给算法
	unsigned short thresholdHigh;//精度0.01，需要*0.01在给算法
	unsigned int longtermSearchSize;
};

/**
 * 返回给地面站当前算法参数
 */
typedef struct skynode_gnd_alg_param_stru {
	common_header_stru headerS;      //包头
	unsigned char devNo;
	DetectParams detectParams;
	TrackParams trackParams;
	unsigned short crc;             //CRC校验
} SKYNODE_GND_ALG_PARAM_S;

/**
 *  地面到吊舱 修改算法参数
 */
typedef struct gnd_skynode_update_params_stru {
	common_header_stru header; //包头
	unsigned char devNo;
	unsigned char type;
	DetectParams detectParams;
	TrackParams trackParams;
	unsigned short crc;        //CRC校验
} GND_SKYNODE_UPDATE_PARAMS_STRU;

typedef struct skynode_gnd_ptz_pid_stru {
	common_header_stru headerS;      //包头
	unsigned short pitch_p;          //俯仰P
	unsigned short pitch_i;          //俯仰I
	unsigned short pitch_d;          //俯仰D
	unsigned short yaw_p;            //航向P
	unsigned short yaw_i;            //航向I
	unsigned short yaw_d;            //航向D
	unsigned short crc;             //CRC校验
} SKYNODE_GND_PTZ_PID_S;

typedef struct gnd_skynode_setptz_pid_stru {
	common_header_stru header;    //包头
	unsigned char type;           // pid类型,参照GndToSkyPtzPIDEnum
	unsigned short p;             // p 精度0.01
	unsigned short i;             // i 精度0.01
	unsigned short d;             // d 精度0.01
	unsigned short crc;           //CRC校验
} GND_SKYNODE_SETPTZ_PID_S;

struct PIDInfo
{
	PIDInfo(unsigned short _p, unsigned short _i, unsigned short _d) {
		p = _p;
		i = _i;
		d = _d;
	}
	unsigned short p;
	unsigned short i;
	unsigned short d;
};
#pragma pack()
#endif //RKBOX_SHI_LIAN_INTERDATADEFINE_H
